home *** CD-ROM | disk | FTP | other *** search
/ Workplace Effectiveness: Critical Thinking Skills / Workplace Effectiveness: Critical Thinking Skills.iso / pc / Files / Patterns.dxr / 00005_Extend handlers.ls < prev    next >
Encoding:
Text File  |  1998-09-16  |  15.9 KB  |  474 lines

  1. global gMasterData, gExtendData, buttonSp, coinSp, coinCoverSp, responseSp, greyScreenSp
  2.  
  3. on pushButton mouseClickV, mouseClickH
  4.   if coinSp < 59 then
  5.     set clickButt to EMPTY
  6.     case 1 of
  7.       inside(point(mouseClickH, mouseClickV), rect(90, 250, 552, 286)):
  8.         case 1 of
  9.           inside(point(mouseClickH, mouseClickV), rect(90, 250, 130, 286)):
  10.             set clickButt to "1"
  11.           inside(point(mouseClickH, mouseClickV), rect(138, 250, 178, 286)):
  12.             set clickButt to "2"
  13.           inside(point(mouseClickH, mouseClickV), rect(185, 250, 225, 286)):
  14.             set clickButt to "3"
  15.           inside(point(mouseClickH, mouseClickV), rect(232, 250, 272, 286)):
  16.             set clickButt to "4"
  17.           inside(point(mouseClickH, mouseClickV), rect(279, 250, 319, 286)):
  18.             set clickButt to "5"
  19.           inside(point(mouseClickH, mouseClickV), rect(326, 250, 366, 286)):
  20.             set clickButt to "6"
  21.           inside(point(mouseClickH, mouseClickV), rect(373, 250, 413, 286)):
  22.             set clickButt to "7"
  23.           inside(point(mouseClickH, mouseClickV), rect(420, 250, 460, 286)):
  24.             set clickButt to "8"
  25.           inside(point(mouseClickH, mouseClickV), rect(465, 250, 507, 286)):
  26.             set clickButt to "9"
  27.           inside(point(mouseClickH, mouseClickV), rect(512, 250, 552, 286)):
  28.             set clickButt to "10"
  29.         end case
  30.       inside(point(mouseClickH, mouseClickV), rect(90, 293, 552, 329)):
  31.         case 1 of
  32.           inside(point(mouseClickH, mouseClickV), rect(90, 293, 130, 329)):
  33.             set clickButt to "11"
  34.           inside(point(mouseClickH, mouseClickV), rect(138, 293, 178, 329)):
  35.             set clickButt to "12"
  36.           inside(point(mouseClickH, mouseClickV), rect(185, 293, 225, 329)):
  37.             set clickButt to "13"
  38.           inside(point(mouseClickH, mouseClickV), rect(232, 293, 272, 329)):
  39.             set clickButt to "14"
  40.           inside(point(mouseClickH, mouseClickV), rect(279, 293, 319, 329)):
  41.             set clickButt to "15"
  42.           inside(point(mouseClickH, mouseClickV), rect(326, 293, 366, 329)):
  43.             set clickButt to "16"
  44.           inside(point(mouseClickH, mouseClickV), rect(373, 293, 413, 329)):
  45.             set clickButt to "17"
  46.           inside(point(mouseClickH, mouseClickV), rect(420, 293, 460, 329)):
  47.             set clickButt to "18"
  48.           inside(point(mouseClickH, mouseClickV), rect(465, 293, 507, 329)):
  49.             set clickButt to "19"
  50.           inside(point(mouseClickH, mouseClickV), rect(512, 293, 552, 329)):
  51.             set clickButt to "20"
  52.         end case
  53.       inside(point(mouseClickH, mouseClickV), rect(90, 336, 552, 372)):
  54.         case 1 of
  55.           inside(point(mouseClickH, mouseClickV), rect(90, 336, 130, 372)):
  56.             set clickButt to "21"
  57.           inside(point(mouseClickH, mouseClickV), rect(138, 336, 178, 372)):
  58.             set clickButt to "22"
  59.           inside(point(mouseClickH, mouseClickV), rect(185, 336, 225, 372)):
  60.             set clickButt to "23"
  61.           inside(point(mouseClickH, mouseClickV), rect(232, 336, 272, 372)):
  62.             set clickButt to "24"
  63.           inside(point(mouseClickH, mouseClickV), rect(279, 336, 319, 372)):
  64.             set clickButt to "25"
  65.           inside(point(mouseClickH, mouseClickV), rect(326, 336, 366, 372)):
  66.             set clickButt to "26"
  67.           inside(point(mouseClickH, mouseClickV), rect(373, 336, 413, 372)):
  68.             set clickButt to "27"
  69.           inside(point(mouseClickH, mouseClickV), rect(420, 336, 460, 372)):
  70.             set clickButt to "28"
  71.           inside(point(mouseClickH, mouseClickV), rect(465, 336, 507, 372)):
  72.             set clickButt to "29"
  73.           inside(point(mouseClickH, mouseClickV), rect(512, 336, 552, 372)):
  74.             set clickButt to "30"
  75.         end case
  76.     end case
  77.     if clickButt <> EMPTY then
  78.       pushButton2(clickButt)
  79.     end if
  80.   end if
  81. end
  82.  
  83. on pushButton2 clickButt
  84.   puppetSound("button tone")
  85.   updateStage()
  86.   case the skillLevel of gExtendData of
  87.     #more, #most:
  88.       set coinValue to value(clickButt)
  89.       set xx to coinValue + 119
  90.       set clickButt to string(xx)
  91.   end case
  92.   setButton(gExtendData, clickButt)
  93.   puppetSprite(buttonSp, 1)
  94.   set gbuttonDn to clickButt && "dn"
  95.   set the memberNum of sprite buttonSp to the number of member gbuttonDn
  96.   set the loc of sprite buttonSp to point(320, 240)
  97.   updateStage()
  98.   if the puppet of sprite coinSp = 1 then
  99.     set the loc of sprite coinSp to point(-999, -999)
  100.     puppetSprite(coinSp, 0)
  101.     updateStage()
  102.   end if
  103.   DelaySome(30)
  104.   set the loc of sprite buttonSp to point(-999, -999)
  105.   puppetSprite(buttonSp, 0)
  106.   updateStage()
  107. end
  108.  
  109. on dropcoin
  110.   puppetSound("Vending machine")
  111.   updateStage()
  112.   case the skillLevel of gExtendData of
  113.     #challenge:
  114.       puppetSprite(coinCoverSp, 1)
  115.       set the loc of sprite coinCoverSp to point(323, 376)
  116.       updateStage()
  117.     #more, #most:
  118.       puppetSprite(coinCoverSp, 1)
  119.       set the loc of sprite coinCoverSp to point(322, 355)
  120.       updateStage()
  121.   end case
  122.   DelaySome(60)
  123.   puppetSprite(coinSp, 1)
  124.   set droppedCoin to getButton(gExtendData) && "coin"
  125.   set the memberNum of sprite coinSp to the number of member droppedCoin
  126.   set the loc of sprite coinSp to point(322, 386)
  127.   updateStage()
  128.   DelaySome(10)
  129.   puppetSound("Coin")
  130.   updateStage()
  131.   set the loc of sprite coinSp to point(322, 402)
  132.   updateStage()
  133.   DelaySome(10)
  134.   set the loc of sprite coinSp to point(322, 425)
  135.   updateStage()
  136.   DelaySome(10)
  137.   set the loc of sprite coinSp to point(322, 438)
  138.   updateStage()
  139.   set the loc of sprite coinCoverSp to point(-999, -999)
  140.   updateStage()
  141.   puppetSprite(coinCoverSp, 0)
  142. end
  143.  
  144. on movingcoin point1, rect1, point2, rect2, point3, rect3
  145.   if the memberNum of sprite coinSp <> 0 then
  146.     set tempName to the name of member the member of sprite coinSp
  147.     if word 2 of tempName = "coin" then
  148.       if the loc of sprite coinSp = point(322, 438) then
  149.         set the moveableSprite of sprite coinSp to 1
  150.       end if
  151.       puppetSprite(coinCoverSp, 1)
  152.       set the loc of sprite coinCoverSp to point(-999, -999)
  153.       updateStage()
  154.       repeat while the mouseDown
  155.         set the locH of sprite coinSp to the mouseH
  156.         set the locV of sprite coinSp to the mouseV
  157.         updateStage()
  158.       end repeat
  159.       case 1 of
  160.         inside(point(the mouseH, the mouseV), rect1):
  161.           if getOneBlank(gExtendData, the ansBlank1 of gExtendData) = 0 then
  162.             set the loc of sprite coinSp to point1
  163.             setBlanks(gExtendData, "filled", EMPTY, EMPTY)
  164.             updateStage()
  165.           else
  166.             set the loc of sprite coinSp to point(322, 438)
  167.           end if
  168.         inside(point(the mouseH, the mouseV), rect2):
  169.           if getOneBlank(gExtendData, the ansBlank2 of gExtendData) = 0 then
  170.             set the loc of sprite coinSp to point2
  171.             setBlanks(gExtendData, EMPTY, "filled", EMPTY)
  172.             updateStage()
  173.           else
  174.             set the loc of sprite coinSp to point(322, 438)
  175.           end if
  176.         inside(point(the mouseH, the mouseV), rect3):
  177.           if getOneBlank(gExtendData, the ansBlank3 of gExtendData) = 0 then
  178.             set the loc of sprite coinSp to point3
  179.             setBlanks(gExtendData, EMPTY, EMPTY, "filled")
  180.             updateStage()
  181.           else
  182.             set the loc of sprite coinSp to point(322, 438)
  183.           end if
  184.         otherwise:
  185.           set the loc of sprite coinSp to point(322, 438)
  186.           setBlanks(gExtendData, EMPTY, EMPTY, EMPTY)
  187.           updateStage()
  188.       end case
  189.       set the moveableSprite of sprite coinSp to 0
  190.       case the skillLevel of gExtendData of
  191.         #challenge:
  192.           set the loc of sprite coinCoverSp to point(323, 376)
  193.         otherwise:
  194.           set the loc of sprite coinCoverSp to point(322, 355)
  195.       end case
  196.       updateStage()
  197.       puppetSprite(coinCoverSp, 0)
  198.     end if
  199.   end if
  200. end
  201.  
  202. on goAnswer1
  203.   puppetSprite(responseSp, 1)
  204.   puppetSprite(greyScreenSp, 1)
  205.   set RespVar to EMPTY
  206.   if getBlank1(gExtendData) = "filled" then
  207.     set gg to the name of member the member of sprite coinSp
  208.     case the skillLevel of gExtendData of
  209.       #challenge:
  210.         set RespVar to "1"
  211.         set printVar to "7,18"
  212.         if gg = "16 coin" then
  213.           setHandCursor(#off, [coinSp])
  214.           incrementCoinSp()
  215.           setOneBlank(gExtendData, the ansBlank1 of gExtendData, 16)
  216.         end if
  217.       #more:
  218.         set RespVar to "4"
  219.         set printVar to "13,31"
  220.         if gg = "124 coin" then
  221.           setHandCursor(#off, [coinSp])
  222.           incrementCoinSp()
  223.           setOneBlank(gExtendData, the ansBlank1 of gExtendData, 124)
  224.         end if
  225.       #most:
  226.         set RespVar to "7"
  227.         set printVar to "19,44"
  228.         if gg = "133 coin" then
  229.           setHandCursor(#off, [coinSp])
  230.           incrementCoinSp()
  231.           setOneBlank(gExtendData, the ansBlank1 of gExtendData, 133)
  232.         end if
  233.     end case
  234.   else
  235.     if getOneBlank(gExtendData, the ansBlank1 of gExtendData) <> 0 then
  236.       case the skillLevel of gExtendData of
  237.         #challenge:
  238.           set tempNum to "1"
  239.         #more:
  240.           set tempNum to "4"
  241.         #most:
  242.           set tempNum to "7"
  243.       end case
  244.       if tempNum <> EMPTY then
  245.         set ResponseVar to "skill Response" && tempNum
  246.         set the memberNum of sprite responseSp to the number of member ResponseVar
  247.         set the loc of sprite responseSp to point(320, 240)
  248.         set the loc of sprite greyScreenSp to point(0, 0)
  249.       end if
  250.     else
  251.       puppetSprite(responseSp, 0)
  252.       puppetSprite(greyScreenSp, 0)
  253.     end if
  254.   end if
  255.   updateStage()
  256.   if RespVar <> EMPTY then
  257.     set ResponseVar to "skill Response" && RespVar
  258.     set the memberNum of sprite responseSp to the number of member ResponseVar
  259.     set the loc of sprite responseSp to point(320, 240)
  260.     set the loc of sprite greyScreenSp to point(0, 0)
  261.     updateStage()
  262.     put line value(item 1 of printVar) of field "answer key" into line value(item 2 of printVar) of field "extendPrint"
  263.     if iAmActivated(gMasterData) = 0 then
  264.       activate(gMasterData)
  265.     end if
  266.   end if
  267. end
  268.  
  269. on goAnswer2
  270.   puppetSprite(responseSp, 1)
  271.   puppetSprite(greyScreenSp, 1)
  272.   set RespVar to EMPTY
  273.   if getBlank2(gExtendData) = "filled" then
  274.     set gg to the name of member the member of sprite coinSp
  275.     case the skillLevel of gExtendData of
  276.       #challenge:
  277.         set RespVar to "2"
  278.         set printVar to "9,21"
  279.         if gg = "18 coin" then
  280.           setHandCursor(#off, [coinSp])
  281.           incrementCoinSp()
  282.           setOneBlank(gExtendData, the ansBlank2 of gExtendData, 18)
  283.         end if
  284.       #more:
  285.         set RespVar to "5"
  286.         set printVar to "15,34"
  287.         if gg = "120 coin" then
  288.           setHandCursor(#off, [coinSp])
  289.           incrementCoinSp()
  290.           setOneBlank(gExtendData, the ansBlank2 of gExtendData, 120)
  291.         end if
  292.       #most:
  293.         set RespVar to "8"
  294.         set printVar to "21,47"
  295.         if gg = "127 coin" then
  296.           setHandCursor(#off, [coinSp])
  297.           incrementCoinSp()
  298.           setOneBlank(gExtendData, the ansBlank2 of gExtendData, 127)
  299.         end if
  300.     end case
  301.   else
  302.     if getOneBlank(gExtendData, the ansBlank2 of gExtendData) <> 0 then
  303.       case the skillLevel of gExtendData of
  304.         #challenge:
  305.           set tempNum to "2"
  306.         #more:
  307.           set tempNum to "5"
  308.         #most:
  309.           set tempNum to "8"
  310.       end case
  311.       if tempNum <> EMPTY then
  312.         set ResponseVar to "skill Response" && tempNum
  313.         set the memberNum of sprite responseSp to the number of member ResponseVar
  314.         set the loc of sprite responseSp to point(320, 240)
  315.         set the loc of sprite greyScreenSp to point(0, 0)
  316.       end if
  317.     else
  318.       puppetSprite(responseSp, 0)
  319.       puppetSprite(greyScreenSp, 0)
  320.     end if
  321.   end if
  322.   updateStage()
  323.   if RespVar <> EMPTY then
  324.     put line value(item 1 of printVar) of field "answer key" into line value(item 2 of printVar) of field "extendPrint"
  325.     set ResponseVar to "skill Response" && RespVar
  326.     set the memberNum of sprite responseSp to the number of member ResponseVar
  327.     set the loc of sprite responseSp to point(320, 240)
  328.     set the loc of sprite greyScreenSp to point(0, 0)
  329.     updateStage()
  330.     if iAmActivated(gMasterData) = 0 then
  331.       activate(gMasterData)
  332.     end if
  333.   end if
  334. end
  335.  
  336. on goAnswer3
  337.   puppetSprite(responseSp, 1)
  338.   puppetSprite(greyScreenSp, 1)
  339.   set RespVar to EMPTY
  340.   if getBlank3(gExtendData) = "filled" then
  341.     set gg to the name of member the member of sprite coinSp
  342.     case the skillLevel of gExtendData of
  343.       #challenge:
  344.         set RespVar to "3"
  345.         set printVar to "11,24"
  346.         if gg = "23 coin" then
  347.           setHandCursor(#off, [coinSp])
  348.           incrementCoinSp()
  349.           setOneBlank(gExtendData, the ansBlank3 of gExtendData, 23)
  350.         end if
  351.       #more:
  352.         set RespVar to "6"
  353.         set printVar to "17,37"
  354.         if gg = "144 coin" then
  355.           setHandCursor(#off, [coinSp])
  356.           incrementCoinSp()
  357.           setOneBlank(gExtendData, the ansBlank3 of gExtendData, 144)
  358.         end if
  359.       #most:
  360.         set RespVar to "9"
  361.         set printVar to "23,50"
  362.         if gg = "149 coin" then
  363.           setHandCursor(#off, [coinSp])
  364.           incrementCoinSp()
  365.           setOneBlank(gExtendData, the ansBlank3 of gExtendData, 149)
  366.         end if
  367.     end case
  368.   else
  369.     if getOneBlank(gExtendData, the ansBlank3 of gExtendData) <> 0 then
  370.       case the skillLevel of gExtendData of
  371.         #challenge:
  372.           set tempNum to "3"
  373.         #more:
  374.           set tempNum to "6"
  375.         #most:
  376.           set tempNum to "9"
  377.       end case
  378.       if tempNum <> EMPTY then
  379.         set ResponseVar to "skill Response" && tempNum
  380.         set the memberNum of sprite responseSp to the number of member ResponseVar
  381.         set the loc of sprite responseSp to point(320, 240)
  382.         set the loc of sprite greyScreenSp to point(0, 0)
  383.       end if
  384.     else
  385.       puppetSprite(responseSp, 0)
  386.       puppetSprite(greyScreenSp, 0)
  387.     end if
  388.   end if
  389.   updateStage()
  390.   if RespVar <> EMPTY then
  391.     put line value(item 1 of printVar) of field "answer key" into line value(item 2 of printVar) of field "extendPrint"
  392.     set ResponseVar to "skill Response" && RespVar
  393.     set the memberNum of sprite responseSp to the number of member ResponseVar
  394.     set the loc of sprite responseSp to point(320, 240)
  395.     set the loc of sprite greyScreenSp to point(0, 0)
  396.     updateStage()
  397.     if iAmActivated(gMasterData) = 0 then
  398.       activate(gMasterData)
  399.     end if
  400.   end if
  401. end
  402.  
  403. on incrementCoinSp
  404.   if coinSp < 59 then
  405.     set coinSp to coinSp + 1
  406.   end if
  407. end
  408.  
  409. on cleanUpCoinSp
  410.   puppetSprite(56, 0)
  411.   puppetSprite(57, 0)
  412.   puppetSprite(58, 0)
  413. end
  414.  
  415. on resetCoinSp point1, point2, point3
  416.   set x to getOneBlank(gExtendData, the ansBlank1 of gExtendData)
  417.   if x <> 0 then
  418.     puppetSprite(coinSp, 1)
  419.     set the memberNum of sprite coinSp to the number of member (x && "coin")
  420.     set the loc of sprite coinSp to point1
  421.     setHandCursor(#off, [coinSp])
  422.     set coinSp to coinSp + 1
  423.   end if
  424.   set y to getOneBlank(gExtendData, the ansBlank2 of gExtendData)
  425.   if y <> 0 then
  426.     puppetSprite(coinSp, 1)
  427.     set the memberNum of sprite coinSp to the number of member (y && "coin")
  428.     set the loc of sprite coinSp to point2
  429.     setHandCursor(#off, [coinSp])
  430.     set coinSp to coinSp + 1
  431.   end if
  432.   set z to getOneBlank(gExtendData, the ansBlank3 of gExtendData)
  433.   if z <> 0 then
  434.     puppetSprite(coinSp, 1)
  435.     set the memberNum of sprite coinSp to the number of member (z && "coin")
  436.     set the loc of sprite coinSp to point3
  437.     setHandCursor(#off, [coinSp])
  438.     set coinSp to coinSp + 1
  439.   end if
  440. end
  441.  
  442. on clickAnswerExample1
  443.   cursor(200)
  444.   updateStage()
  445.   go("example1")
  446.   put line 1 of field "answer key" into line 5 of field "extendPrint"
  447. end
  448.  
  449. on clickAnswerExample2
  450.   cursor(200)
  451.   updateStage()
  452.   go("example2")
  453.   put line 3 of field "answer key" into line 8 of field "extendPrint"
  454. end
  455.  
  456. on clickAnswerExample3
  457.   cursor(200)
  458.   updateStage()
  459.   go("example3")
  460.   put line 5 of field "answer key" into line 11 of field "extendPrint"
  461. end
  462.  
  463. on clickSkillButton
  464.   exitChooseSkill()
  465.   case the clickOn of
  466.     19:
  467.       goChallenge()
  468.     20:
  469.       goMoreChallenge()
  470.     21:
  471.       goMostChallenge()
  472.   end case
  473. end
  474.